<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2019-9-12
 * Time: 11:05
 */
namespace  app\common\validate;

use think\Validate;

class Admin extends Validate{

    protected $rule=[
        'username'=>'require|unique:admin|min:3',
        'phone'=>'require|number|unique:admin',
        'email'=>'require|email|unique:admin',
        'pass'=>'require',
        'repass'=>'require|confirm:pass',
    ];

    protected $message=[
        'username.require'=>'帐号不能为空',
        'username.unique'=>'帐号已存在',
        'username.require'=>'帐号长度不能小于三位',
        'phone.require'=>'手机不能为空',
        'phone.number'=>'手机必须是纯数字',
        'phone.unique'=>'手机已存在',
        'email.require'=>'邮箱不能为空',
        'email.email'=>'邮箱格式不正确',
        'email.unique'=>'邮箱已存在',
        'pass'=>'密码不能为空',
        'repass'=>'确认密码不能为空',
        'repass.confirm'=>'两次密码输入不一致',
    ];

    protected $scene=[
        'add'=>['username','phone','email','ress','repass'],
        'edit'=>['username'=>'require','phone'=>'require','email'=>'require'],
    ];


}